import getopt
from CommonUIImp.DefaultLogger import DefaultLogger
from UserInterface.MyLogger import LogLevel
from Code.SystemInitialization import Initialization
from Code.SystemInitialization import EnterInvokeMode
from Code.SystemInitialization import TuiMode
from UserInterface.InvokeInstruction import GetInvokeOptStr

g_logger = DefaultLogger(LogLevel.INFO)

def main():
    import sys
    Initialization(g_logger)
    try:
        opts, args = getopt.getopt(sys.argv[1:], GetInvokeOptStr())
    except:
        print('opt input error')
        return
    if len(opts):
        # Commond Line Invoke
        EnterInvokeMode(opts)
    else:
        TuiMode()

if __name__ == '__main__':
    main()